//	Project:	HexTower
//	File:		Tile.cpp
//	Author:		Mustafa Aldoori
//	Purpose:	Tile Class implementation.

#include "Tile.h"

CTile::CTile( void )
{
	CBaseObject::m_nType = OBJ_BASE;

	m_nTileLayer = -1;
	m_nTileImageID = -1;
	m_nTileX = -1;
	m_nTileY = -1;

	SetX( -64.0f );
	SetY( -64.0f );
}

CTile::~CTile( void )
{

}

void CTile::Update( float fElapsed )
{
	CBaseObject::Update( fElapsed );
}

void CTile::Render( )
{
	// Should not be used.
}

void CTile::SetTileX( int nTileX )
{
	m_nTileX = nTileX;

	SetX( (float)(m_nTileX * GetWidth() ) );
}

void CTile::SetTileY( int nTileY )
{
	m_nTileY = nTileY;

	SetY( (float)(m_nTileY * GetHeight() ) );
}

bool CTile::CheckCollision( CBaseObject * pBase )
{
	RECT r;
	bool isColliding = IntersectRect( &r, &pBase->GetRect(), &GetRect() );

	return isColliding;
}

RECT CTile::GetRect( )
{
	RECT r;
	r.left		=	( LONG )( GetX() );
	r.top		=	( LONG )( GetY() );
	r.right		=	( LONG )( GetX() + GetWidth() );
	r.bottom	=	( LONG )( GetY() + GetHeight() );

	return r;
}